I tried SSM Automation.
SSM (Systems Manager) allows you to see and manage your AWS infrastructure. SSM organises your inventory by organising resources by application or environment, as well as connecting with CloudWatch to monitor dashboards and operational data. SSM may automate operational operations such running pre-defined commands on one or more EC2 instances, altering the instance state, attaching/detaching EBS volumes, making snapshots, and applying patches and upgrades for increased efficiency.
Automation enables you to do the following:
- Build Automation workflows to configure and manage instances and AWS resources.
- Create custom workflows or use pre-defined workflows maintained by AWS.
- Receive notifications about Automation tasks and workflows by using Amazon Cloudwatch Events.
- Monitor Automation progress and execution details by using the Amazon EC2 or the AWS Systems Manager console.
SSM Automation use cases
- Perform common IT tasks
- Safely perform disruptive tasks in bulk
- Update AMI
Hands-on
Step1: Open Systems Manager page in console.
Step2: Click on Automation under Change Management.
Step3: Click on Execute Automation.
Here you will find several predefined documents like "AWS-AttachEBSVolume", "AWS-PatchAsgInstance" and "AWS-CreateImage" etc, these predefined documents consists of logic in background to perform tasks, but you can also use custom documents where you can write your own logic based on your requirements .
Step4:Select required document and click on next, for this blog I have used "AWS-CreateImage" Document.
Here you can select the execution type, I have selected Simple Execution.
Step 4:Select your Instance Id and click "Execute," then sit back and enjoy your coffee while the task completes all of your work.
If everything goes smoothly you will get a success message.
Now you can check your AMI under EC2->AMIs
Conclusion
SSM Automation is a capability of AWS Systems Manager which streamline and automate common maintenance, deployment, and remediation tasks for AWS services such as EC2, RDS, Amazon Redshift, S3, and many others.